package org.example.finalsecurities.task;

import lombok.extern.slf4j.Slf4j;
import org.example.finalsecurities.service.CalendarService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 爬取新股上市日历任务
 *
 * @author : [CaiJianbin]
 * @version : [v1.0]
 */
@Component
@Slf4j
public class CrawlNewStockCalendarJob implements Job {
    @Autowired
    private CalendarService calendarService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        calendarService.delete();
        calendarService.fetchAndUpdateCalendar();
        log.info("成功爬取新股上市日历");
    }
}
